const corsMiddleware = async (ctx, next) => {
  ctx.set("Access-Control-Allow-Credentials", "true");
  ctx.set("Access-Control-Allow-Origin", ctx.get("Origin"));
  ctx.set("Access-Control-Allow-Methods", "POST");
  ctx.set(
    "Access-Control-Allow-Headers",
    "Origin, X-Requested-With, Content-Type, Accept, If-Modified-Since, Authorization"
  );

  await next();
};

module.exports = corsMiddleware;
